<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <ul id="ul1">
        <li class="aa">1</li>
        <li class="aa">2</li>
        <li class="aa">3</li>
        <li class="aa">4</li>
        <li>5</li>
        <li>6</li>
        <li>7</li>
    </ul>
    <ul id="ul2">
        <li class="aa">1</li>
        <li class="aa">2</li>
        <li class="aa">3</li>
        <li class="aa">4</li>
        <li>5</li>
        <li>6</li>
        <li>7</li>
    </ul>
    <script>
        // 获取ul1下的li标签且样式为aa的
        // 方式一
        let ul1 = document.getElementById("ul1");
        let lis = [];
        for (let index in ul1.children) {
            if (ul1.children[index].className == "aa") lis.push(ul1.children[index]);
        }
        console.log(lis);
        // 方式二
        console.log(ul1.getElementsByClassName("aa"));
        // 方式三
        console.log(document.querySelectorAll("#ul1 .aa"))
    </script>
</body>
</html>